package com.zhaotianhao.springboot_demo_fire.controller;

import com.zhaotianhao.springboot.fileupload.common.FileResult;
import com.zhaotianhao.springboot.fileupload.service.FileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;


/**
 * @Author Z-7
 * @Date 2022/3/22
 */
@RestController
@RequestMapping("file")
public class FileController {
    @Autowired(required = false)
    private FileService fileService;
    @GetMapping("upload")
    public Object upload(MultipartFile file){
        FileResult upload = fileService.uploadFile(file);
        return upload;
    }
}
